<script setup>
import { onLaunch } from "@dcloudio/uni-app";
import { reactive, ref } from "vue";

// 定义全局数据
const globalData = reactive({
  openid: null,
  userInfo: null,
  hasLogin: false,
});

onLaunch(async () => {
  // 检查本地存储中是否有 openid
  try {
    const res = await uni.getStorage({ key: "openid" });
    console.log("本地存储中已有 openid:", res.data);
    globalData.openid = res.data;
    globalData.hasLogin = true;
  } catch (error) {
    console.log("本地没有 openid");
  }
});
</script>
<style lang="scss">
/* 注意要写在第一行，同时给style标签加入lang="scss"属性 */
@import "uview-plus/index.scss";
</style>
